#include "EpollServer.hpp"

void Format(const char *str)
{
    // [ip]意思是可有可无，没有则默认绑定0.0.0.0号ip
    std::cout << "Format: " << str << "  [ip]  port" << std::endl;
    exit(3);
}

int main(int argc, char *argv[])
{
    if (argc < 2) Format(argv[0]);
    string ip;
    uint16_t port;
    if (argc == 3)
    {
        ip = argv[1];
        port = std::stoi(argv[2]);
    }
    else if (argc == 2)
    {
        port = std::stoi(argv[1]);
    }

    EpollServer eps(port, ip);
    eps.InitepollServer();
    eps.StartepollServer();
    return 0;
}